package br.com.lambdacore.validator.impl;

public class ArrayValidator extends ValidatorImpl<Object[]> {

	protected ArrayValidator(Object[] object) {
		super(object);
	}

	public boolean empty() {
		Object[] objects = this.getObject();
		boolean nil = true;
		for (Object object : objects) {
			nil = is(object).nil() && nil;
		}
		return nil;
	}

	public boolean hasNull() {
		Object[] objects = this.getObject();
		boolean nil = false;
		for (Object object : objects) {
			nil = is(object).nil() || nil;
		}
		return nil;
	}

	public boolean lengthEqualThan(int length) {
		return is(this.getObject().length).equalThan(length);
	}

	public boolean lengthGreaterEqualThan(int length) {
		return is(this.getObject().length).greaterEqualThan(length);
	}

	public boolean lengthGreaterThan(int length) {
		return is(this.getObject().length).greaterThan(length);
	}

	public boolean lengthLessEqualThan(int length) {
		return is(this.getObject().length).lessEqualThan(length);
	}

	public boolean lengthLessThan(int length) {
		return is(this.getObject().length).lessThan(length);
	}

	public boolean notEmpty() {
		return !this.empty();
	}

	public boolean notHasNull() {
		return !this.hasNull();
	}

	public static ArrayValidator is(Object[] objects) {
		return new ArrayValidator(objects);
	}

}
